<div class="navbar navbar-inverse navbar-default navbar-fixed-top" role="navigation">
  <div class="container">
    <div class="navbar-header">
      <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
      <%= link_to root_path do %>
        <%= image_tag 'thingspeak_logo_white.png', :size => '188x35', :style => 'padding: 0 8px; margin-top: 7px;' %>
      <% end %>
    </div>
    <div class="navbar-collapse collapse">
      <ul class="nav navbar-nav">

        <% if current_user %>

          <li class="<%= "active " if @menu == 'channels' %>dropdown">
            <a href="#" class="dropdown-toggle" data-toggle="dropdown"><%=t(:channels)%> <b class="caret"></b></a>
            <ul class="dropdown-menu">
              <li><%= link_to t(:channels_my), channels_path %></li>
              <li><%= link_to t(:watched_channels), watched_channels_path %></li>
              <li><%= link_to t(:channels_public), public_channels_path %></li>
            </ul>
          </li>
          <li <%= "class=active" if @menu == 'plugins' %>><%= link_to t(:plugins), plugins_path %></li>
          <li class="<%= "active " if @menu == 'account' %>dropdown">
            <a href="#" class="dropdown-toggle" data-toggle="dropdown"><%=t(:account)%> <b class="caret"></b></a>
            <ul class="dropdown-menu">
              <li><%= link_to t(:myaccount), account_path %></li>
              <li><%= link_to t(:account_edit), edit_account_path %></li>
              <li><%= link_to t(:public_profile), user_profile_path(current_user.login) %></li>
              <li><%= link_to t(:profile_edit), edit_profile_path %></li>
            </ul>
          </li>
          <% if current_admin_user.present? %>
            <li><%= link_to t(:admin), "/admin", 'data-no-turbolink' => 'true' %></li>
          <% end %>

        <% else %>
            <li <%= "class=active" if @menu == 'channels' %>><%= link_to t(:channels), public_channels_path %></li>
        <% end %>

      </ul>
      <ul class="nav navbar-nav navbar-right">

        <li class="<%= "active " if @menu == 'support' %>dropdown">
          <a href="#" class="dropdown-toggle" data-toggle="dropdown"><%=t(:support)%> <b class="caret"></b></a>
          <ul class="dropdown-menu">
            <li><a href="/docs"><%= t(:documentation) %></a></li>
            <li><a href="/docs/tutorials/"><%= t(:tutorials) %></a></li>
            <li><a href="http://community.thingspeak.com/forum/"><%= t(:forum) %></a></li>
          </ul>
        </li>

        <li><a href="http://community.thingspeak.com/"><%= t(:blog)%></a></li>

        <% if current_user %>
          <li><%= link_to t(:signout), logout_path %></li>
        <% else %>
          <li><%= link_to t(:signin), login_path %></li>
          <li><%= link_to t(:signup), new_user_registration_path %></li>
        <% end %>

      </ul>
    </div><!--/.nav-collapse -->
  </div>
</div>

